﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using xKnight.Models;

namespace xKnight.Attacking
{
    class Program
    {
        static void Main(string[] args)
        {
            const int crawlSettingId = 96;
            const int numberOfAgentsPerAttack =1;
            const AttackType attackType=AttackType.CSRF;
            //AttackType attackType = AttackType.SimpleXss | AttackType.EncodedXss;

            AttackManager attackManager = new AttackManager(crawlSettingId, numberOfAgentsPerAttack, attackType);

            attackManager.AttackCompleted += attackManager_AttackCompleted;
            attackManager.AttackStarted += attackManager_AttackStarted;
            attackManager.AttackAnnounced += attackManager_AttackAnnounced;

            attackManager.Attack();

            Console.ReadLine();
        }

        static void attackManager_AttackStarted(object sender, AttackStartedEventArgs e)
        {
            int attackId=e.AttackId;
            DateTime dtStart= e.StartDateTime;

            Console.WriteLine("Attack operation started");
        }

        static void attackManager_AttackCompleted(object sender, AttackCompletedEventArgs e)
        {
            int attackId = e.AttackId;
            DateTime dtFinish = e.FinishDateTime;

            Console.WriteLine("Attack operation finished");
        }

        static void attackManager_AttackAnnounced(object sender, AttackAnnouncedEventArgs e)
        {
            AttackAnnounceItem announceItem = e.AnnounceItem;
            int attackId = announceItem.AttackId;
            DateTime dateTime= announceItem.DateTime;
            string description= announceItem.Description;
            int numberOfAttacks= announceItem.NumberOfAttacks;
            string PageReponseDecription= announceItem.PageReponseDecription;
            int pageResposeCode= announceItem.PageResponseCode;
            string url=announceItem.Url;            

            Console.WriteLine("Attack operation announced");
        }
    }
}
